package com.base.domain.moudles.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.base.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

/**
* @Description: 系统用户表
* @Param:
* @return:
* @Author: zhou minghao
* @Date: 15:53 2024/4/22
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_user")
@ApiModel(value="SysUser对象", description="系统用户表")
@Builder(toBuilder = true)
@Accessors(chain = true)
public class User extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键，自增")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户名")
    private String userName;

    @ApiModelProperty(value = "姓名")
    private String fullName;

    @ApiModelProperty(value = "密码，md5+盐 hash")
    private String password;

    @ApiModelProperty(value = "盐(干扰项)")
    private String salt;

    @ApiModelProperty(value = "手机号码")
    private String mobileNumber;

    @ApiModelProperty(value = "工号")
    private String empNo;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "所属部门，存组织架构表（sys_department）的主键")
    private Integer departId;

    @ApiModelProperty(value = "头像地址，存头像的相对路径")
    private String headSculpture;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "状态， 1：启用，2：禁用.   默认启用")
    private String status;

    @ApiModelProperty(value = "登录来源, 这里填登录用户的ip地址")
    private String loginSource;

    @ApiModelProperty(value = "上次登录时间")
    private Date lastLoginTime;

    @ApiModelProperty(value = "上次设置密码的时间")
    private Date lastPasswordSettingTime;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建用户ID（引用系统用户表（sys_user）的主键（id）字段")
    private Integer createUser;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @TableField(exist = false)
    @ApiModelProperty("用户角色ID")
    private Integer roleId;

    @TableField(exist = false)
    private List<Integer> roles;


}
